import os

import librosa
from tqdm import tqdm

if __name__ == '__main__':
    files = [f for f in os.listdir('data') if f.lower().endswith('.mp3')]
    num_files = len(files)
    print('num_files: ' + str(num_files))

    total_duration = 0

    for file in tqdm(files):
        filename = os.path.join('data', file)
        y, sr = librosa.load(filename)
        duration = librosa.get_duration(y, sr)
        total_duration += duration

    print('total_duration: ' + str(total_duration))
